<?php

namespace app\admin\model\shortvideo;

use think\Model;


class Info extends Model
{

    

    

    // 表名
    protected $name = 'shortvideo_info';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'type_text',
        'version_type_text',
        'is_banner_text'
    ];
    

    
    public function getTypeList()
    {
        return ['1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3'), '4' => __('Type 4'), '5' => __('Type 5'), '6' => __('Type 6'), '7' => __('Type 7')];
    }

    public function getVersionTypeList()
    {
        return ['1' => __('Version_type 1'), '2' => __('Version_type 2')];
    }

    public function getIsBannerList()
    {
        return ['1' => __('Is_banner 1'), '2' => __('Is_banner 2')];
    }


    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getVersionTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['version_type']) ? $data['version_type'] : '');
        $list = $this->getVersionTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getIsBannerTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['is_banner']) ? $data['is_banner'] : '');
        $list = $this->getIsBannerList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
